import {
    Inject, Controller,
    Get
} from '@midwayjs/core';
import { CaptchaCodeService } from '../service/captcha.service';

@Controller('/captcha')
export class UserController {

    @Inject()
    captchaService: CaptchaCodeService;
    @Get('/imageCaptcha')
    async getCaptcha() {
        const { id, imageBase64 } = await this.captchaService.getCaptcha()
        return {
            code: 200,
            data: {
                id,
                code: imageBase64
            }
        }
    }

} 